$(document).ready(function() {

    var act_submit = false;
    $("#save_exchange").click(function() {
        if (act_submit === false) {
            act_submit = true;
            if ($("#exchange_value").val() != "") {
                $.post("ajax/updateExchange.php", {
                    exchange: $("#exchange_value").val()
                }, function(res) {
                    act_submit = false;
                    if (res.type == 0) {
                        $("#alert-success-category").html(res.msg).show();
                        hideError("#alert-success-category");
                        $("#exchange_value").val("");

                        location.reload();
                    } else {
                        $("#alert-error-category").html(res.msg).show();
                        hideError("#alert-error-category");
                    }
                }, "json");

            } else {
                act_submit = false;
                $("#alert-error-category").html("Vui lòng điền tỉ giá!").show();
                hideError("#alert-error-category");
                return false;
            }
        } else {
            return false;
        }
    });

});



 